#include <bits/stdc++.h>
using namespace std;
const int N = 1e4 + 5;

int n, now, tmp = 1, mx = 1;
int a[N];
int main() {
    cin >> n;
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int i = 2; i <= n; ++i) {
        if (a[i] - a[i - 1] == 1) ++tmp;
        else {
            mx = max(mx, tmp);
            tmp = 1;
        }
    }
    mx = max(mx, tmp);
    cout << mx << endl;
    return 0;
}